package com.itlzh.mall.common.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.itlzh.mall.common.handler.EncryptHandler;
import com.itlzh.mall.common.utils.EncryptUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
//表-类 映射，开启自动结果集进行 属性-字段 映射
@TableName(value = "user_receive_address",  autoResultMap = true)
public class UserReceiveAddress {
    @TableField(value = "id", fill = FieldFill.INSERT)
    private Long id;
    private Long userId;
    private String name;
    private String phoneNumber;
    @TableField(fill = FieldFill.INSERT)
    private int default_status;
    private String postCode;
    private String province;
    private String city;
    private String region;
    //指定该数据需要进行加密
    @TableField(typeHandler = EncryptHandler.class)
    private String detailAddress;

    public String getEncryptPhoneNumber(){
        return EncryptUtils.hidePhone(getPhoneNumber());
    }
}
